package com.tgu.home_action.pojo;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.fasterxml.jackson.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import springfox.documentation.annotations.ApiIgnore;


import javax.validation.constraints.NotNull;
import java.sql.Timestamp;

@Data
@ApiModel(description = "管理员用户")
public class Admin {
    public interface login {
    }

    public interface district {
    }

    public interface update {

    }

    @NotNull(message = "id不能为空", groups = {update.class})
    @ApiModelProperty("管理员ID")
    private Integer id;
    /**
     * 用户名
     */
    @NotNull(message = "用户名不能为空", groups = {login.class, district.class})
    private String userName;
    /**
     * 密码
     */
    @NotNull(message = "密码不能为空", groups = {login.class, district.class})
    @JsonBackReference("密码")
    private String password;

    @ApiModelProperty("管理员角色")
    private String role;

    @ApiModelProperty("管理员角色ID")
    private Integer roleId;

    @NotNull(message = "province不能为空", groups = {district.class})
    @ApiModelProperty("管理员管辖区所在省")
    private String province;

    @NotNull(message = "city不能为空", groups = {district.class})
    @ApiModelProperty("管理员管辖区所在市")
    private String city;

    @NotNull(message = "district不能为空", groups = {district.class})
    @ApiModelProperty("管理员管辖区")
    private String district;

    @ApiModelProperty("姓名")
    private String name;

    @ApiModelProperty("性别")
    private Short sex;

    @ApiModelProperty("头像")
    private String avatarUrl;

    @ApiModelProperty(value = "注册时间", dataType = "java.sql.Date")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Timestamp registerTime;

    @ApiModelProperty("用户状态（1为启用，2为停用）")
    private Short state;

    @JsonBackReference("当前页")
    @ApiModelProperty("当前页")
    private Integer pageNo;

    @JsonBackReference("每页条数")
    @ApiModelProperty("每页条数")
    private Integer pageSize;

    @JsonIgnore
    private Integer startSize;

    public Admin() {
    }

    public Admin(Integer id, String adminRole) {
        this.id = id;
        this.role = adminRole;
    }


}
